home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / layout / nsILineIterator.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  6KB  |  146 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is Mozilla Communicator client code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  26.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37. #ifndef nsILineIterator_h___
  38. #define nsILineIterator_h___
  39.  
  40. #include "nsISupports.h"
  41.  
  42. /* a6cf90ff-15b3-11d2-932e-00805f8add32 */
  43. #define NS_ILINE_ITERATOR_IID \
  44.  { 0xa6cf90ff, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
  45.  
  46. /* {80AA3D7A-E0BF-4e18-8A82-2110397D7BC4}*/
  47. #define NS_ILINE_ITERATOR_NAV_IID \
  48.  { 0x80aa3d7a, 0xe0bf, 0x4e18,{0x8a, 0x82, 0x21, 0x10, 0x39, 0x7d, 0x7b, 0xc4}}
  49.  
  50. // Line iterator API.
  51. //
  52. // Lines are numbered from 0 to N, where 0 is the top line and N is
  53. // the bottom line.
  54. //
  55. // NOTE: while you can get this interface by doing a slezy hacky
  56. // QueryInterface on block frames, it isn't like a normal com
  57. // interface: its not reflexive (you can't query back to the block
  58. // frame) and unlike other frames, it *IS* reference counted so don't
  59. // forget to NS_RELEASE it when you are done with it!
  60.  
  61. // Line Flags (see GetLine below)
  62.  
  63. // This bit is set when the line is wrapping up a block frame. When
  64. // clear, it means that the line contains inline elements.
  65. #define NS_LINE_FLAG_IS_BLOCK           0x1
  66.  
  67. // This bit is set when the line ends in some sort of break.
  68. #define NS_LINE_FLAG_ENDS_IN_BREAK      0x4
  69.  
  70. class nsILineIterator : public nsISupports {
  71. public:
  72.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILINE_ITERATOR_IID)
  73.  
  74.   // Return the number of lines in the block.
  75.   NS_IMETHOD GetNumLines(PRInt32* aResult) = 0;
  76.  
  77.   // Return the prevailing direction for the line. aIsRightToLeft will
  78.   // be set to PR_TRUE if the CSS direction property for the block is
  79.   // "rtl", otherwise aIsRightToLeft will be set to PR_FALSE.
  80.   NS_IMETHOD GetDirection(PRBool* aIsRightToLeft) = 0;
  81.  
  82.   // Return structural information about a line. aFirstFrameOnLine is
  83.   // the first frame on the line and aNumFramesOnLine is the number of
  84.   // frames that are on the line. If the line-number is invalid then
  85.   // aFirstFrameOnLine will be nsnull and aNumFramesOnLine will be
  86.   // zero.
  87.   //
  88.   // For valid line numbers, aLineBounds is set to the bounding box of
  89.   // the line (which is based on the in-flow position of the frames on
  90.   // the line; if a frame was moved because of relative positioning
  91.   // then its coordinates may be outside the line bounds).
  92.   //
  93.   // In addition, aLineFlags will contain flag information about the
  94.   // line.
  95.   NS_IMETHOD GetLine(PRInt32 aLineNumber,
  96.                      nsIFrame** aFirstFrameOnLine,
  97.                      PRInt32* aNumFramesOnLine,
  98.                      nsRect& aLineBounds,
  99.                      PRUint32* aLineFlags) = 0;
  100.  
  101.   // Given a frame thats a child of the block, find which line its on
  102.   // and return that line index into aIndexResult. aIndexResult will
  103.   // be set to -1 if the frame cannot be found.
  104.   NS_IMETHOD FindLineContaining(nsIFrame* aFrame,
  105.                                 PRInt32* aLineNumberResult) = 0;
  106.  
  107.   // Given a Y coordinate relative to the block that provided this
  108.   // line iterator, find the line that contains the Y
  109.   // coordinate. Returns -1 in aLineNumberResult if the Y coordinate
  110.   // is above the first line. Returns N (where N is the number of
  111.   // lines) if the Y coordinate is below the last line.
  112.   NS_IMETHOD FindLineAt(nscoord aY,
  113.                         PRInt32* aLineNumberResult) = 0;
  114.  
  115.   // Given a line number and an X coordinate, find the frame on the
  116.   // line that is nearest to the X coordinate. The
  117.   // aXIsBeforeFirstFrame and aXIsAfterLastFrame flags are updated
  118.   // appropriately.
  119.   NS_IMETHOD FindFrameAt(PRInt32 aLineNumber,
  120.                          nscoord aX,
  121.                          nsIFrame** aFrameFound,
  122.                          PRBool* aXIsBeforeFirstFrame,
  123.                          PRBool* aXIsAfterLastFrame) = 0;
  124.  
  125.   // Give the line iterator implementor a chance todo something more complicated than
  126.   // nsIFrame::GetNextSibling()
  127.   NS_IMETHOD GetNextSiblingOnLine(nsIFrame*& aFrame, PRInt32 aLineNumber) = 0;
  128.  
  129. #ifdef IBMBIDI
  130.   // Check whether visual and logical order of frames within a line are identical.
  131.   //  If not, return the first and last visual frames
  132.   NS_IMETHOD CheckLineOrder(PRInt32                  aLine,
  133.                             PRBool                   *aIsReordered,
  134.                             nsIFrame                 **aFirstVisual,
  135.                             nsIFrame                 **aLastVisual) = 0;
  136. #endif
  137. };
  138.  
  139. //special line iterator for keyboard navigation
  140. class nsILineIteratorNavigator : public nsILineIterator {
  141. public:
  142.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILINE_ITERATOR_NAV_IID)
  143.  
  144. };
  145. #endif /* nsILineIterator_h___ */
  146.